package com.xsir.ditan.miniprogram.common;

import com.xsir.ditan.miniprogram.exception.CustomException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author user
 * @date 2021/2/1
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    
    @ExceptionHandler(CustomException.class)
    public Result customExceptionHandler(CustomException e) {
        return new Result(e.getErrorCode(), e.getErrorMsg());
    }
}
